-
Notifications
You must be signed in to change notification settings - Fork 704
fix: disable Unicode escaping in JSON output and correct Meta type assignment #526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Modify writeResponse in server/stdio.go to use json.NewEncoder with SetEscapeHTML(false) - This prevents Unicode characters from being escaped to \uXXXX format - Maintains compatibility while improving readability for non-ASCII characters
- Fix type error where map[string]any was being assigned to *Meta - Create proper Meta struct with AdditionalFields from unmarshaled data - This resolves build errors in the Go compiler
WalkthroughThe changes update JSON handling in two areas: the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (7)📓 Common learnings
📚 Learning: tool responses from the mcp server shouldn't contain rawinputschema, which is why the unmarshaljson ...
Applied to files:
📚 Learning: the tool struct in the mark3labs/mcp-go project should handle both inputschema and rawinputschema co...
Applied to files:
📚 Learning: in go mcp server, servertool.tool field is only used for tool listing and indexing, not for tool exe...
Applied to files:
📚 Learning: the tool struct in mark3labs/mcp-go handles both inputschema and rawinputschema formats. when unmars...
Applied to files:
📚 Learning: in the mark3labs/mcp-go project, the mcpserver.capabilities field is a struct value (servercapabilit...
Applied to files:
📚 Learning: in the mcp-go library, the getpromptparams.arguments field is of type map[string]string, not map[str...
Applied to files:
🧬 Code Graph Analysis (1)mcp/tools.go (1)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Summary
This PR fixes two issues in the mcp-go library:
\uXXXX
format in stdio transportCallToolResult
unmarshalingChanges
1. Fix Unicode Escaping (
server/stdio.go
)json.Marshal()
withjson.NewEncoder()
inwriteResponse()
functionencoder.SetEscapeHTML(false)
to disable HTML/Unicode escapingBefore: